const VERSION='0.0.1'
//const HOST='http://139.196.137.75'
const Host='https://zlzfcloud.xyz'

const REQUEST=function(url, data={},type='POST') {
	let accessToken = userInfo ? userInfo.token : ''
	var promise = new Promise((resolve, reject) => {
		var _this = this;
		var param = data;
		console.log('apiParam',param)
		uni.request({
			url: HOST+url,
			data: param,
			method: type,
			header: {
				'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
				'token': accessToken
			},
			success: function (res) {
				console.log('api.res',res.data)
				resolve(res.data);
				/* if (res.data.code == "000000" || res.data.code == "000500" ) {
					// 000500 创建订单时有未付款订单
					resolve(res.data);
				} else {
					reject(res.data.msg);
				} */
			},
			error: function (e) {
				reject('网络出错');
			}
		})
	});
	return promise;
}
const POST=function(url, data) {
	return REQUEST(url, data );
}
const GET=function(url, data) {
	return REQUEST(url, data , 'GET');
}


export default {
	HOST,
	POST,
	GET
}


